<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition template="../template/template.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<body>
	
<ui:define name="content">
	<h:form prependId="false" >
		 <p:panel header="Cadastrar Estabelecimento:" styleClass="conteudo">
				
				<br></br>
				<h:panelGrid id="grid" columns="12" >
				
					<h:outputLabel styleClass="label_10" for="nome" value="#{msg.label_nome} " /><strong>*</strong>
					<p:inputText id="nome" value="#{estabelecimentoMB.estabelecimento.nome}" size="35"  disabled="#{estabelecimentoMB.isDisabled}"/>

					<h:outputLabel styleClass="label_40" value="#{msg.label_Segmento} :" /><strong>*</strong>
					<p:selectOneMenu id="area" value="#{estabelecimentoMB.estabelecimento.area}" disabled="#{estabelecimentoMB.isDisabled}">
						<f:selectItem itemLabel="Selecione... " ></f:selectItem>
						<f:selectItems value="#{estabelecimentoMB.listaSegmento}" var="seg"
							 itemLabel="#{seg.nome}" itemValue="#{seg.id}"></f:selectItems>
					</p:selectOneMenu>
				
					<h:outputLabel styleClass="label_10" for="cnpj" value="#{msg.label_cnpj} " /><strong>*</strong>
					<p:inputMask id="cnpj" value="#{estabelecimentoMB.estabelecimento.cnpj}" size="15" mask="99.999.999/9999-99" disabled="#{estabelecimentoMB.isDisabled}"/>
					
				</h:panelGrid>
				
				<br></br>
				
				<h:panelGrid columns="7" styleClass="label_27" >
					<h:outputLabel for="cep" value="#{msg.label_cep} " />
					<p:inputMask id="cep" value="#{estabelecimentoMB.estabelecimento.cep}"  size="15" mask="99999-999" disabled="#{estabelecimentoMB.isDisabled}"/>
					<p:commandButton ajax="false" id="buscarEnd" update="rua cidade bairro" action="#{estabelecimentoMB.buscarEndereco}" value="Buscar" disabled="#{estabelecimentoMB.isDisabled}"/>
					  
					<h:outputLabel styleClass="label_130" for="rua" value="#{msg.label_rua} " />
					<p:inputText  id="rua" value="#{estabelecimentoMB.estabelecimento.rua}" size="40" disabled="#{estabelecimentoMB.isDisabled}" />

					<h:outputLabel styleClass="label_35" for="num" value="#{msg.label_numero} " />
					<p:inputText id="num" value="#{estabelecimentoMB.estabelecimento.numero}" size="4" disabled="#{estabelecimentoMB.isDisabled}" />
				</h:panelGrid>

				<br></br>

				<h:panelGrid columns="6" styleClass="label_20">
					<h:outputLabel for="bairro" value="#{msg.label_bairro} " />
					<p:inputText id="bairro" value="#{estabelecimentoMB.estabelecimento.bairro}" size="25" disabled="#{estabelecimentoMB.isDisabled}" />

					<h:outputLabel styleClass="label_129" for="cidade" value="#{msg.label_cidade} " />
					<p:inputText id="cidade" value="#{estabelecimentoMB.estabelecimento.cidade}" size="25" disabled="#{estabelecimentoMB.isDisabled}" />

					<h:outputLabel styleClass="label_130" value="#{msg.label_uf} "></h:outputLabel>
					<p:selectOneMenu style="width:65px;" id="estado" disabled="#{estabelecimentoMB.isDisabled}"
						value="#{estabelecimentoMB.estabelecimento.uf}">
						<f:selectItem itemLabel="" ></f:selectItem>
						<f:selectItems value="#{estabelecimentoMB.estados}" ></f:selectItems>
					</p:selectOneMenu>
				</h:panelGrid>
				
				<br></br>

				<h:panelGrid columns="7" style="margin-bottom:10px">
					<h:outputLabel for="telefone" value="#{msg.label_res} " />
					<p:inputMask id="telefone" style="margin-left:4px;" value="#{estabelecimentoMB.estabelecimento.residencial}" size="15" mask="(99) 9999-9999" disabled="#{estabelecimentoMB.isDisabled}" />

					<h:outputLabel styleClass="label_191" for="celular" value="#{msg.label_cel} " />
					<p:inputMask id="celular" value="#{estabelecimentoMB.estabelecimento.celular}" size="15" mask="(99) 9999-9999" disabled="#{estabelecimentoMB.isDisabled}" />

					<h:outputLabel styleClass="label_170" for="comercial" value="#{msg.label_com} " />
					<p:inputMask id="comercial" value="#{estabelecimentoMB.estabelecimento.comercial}" size="15" mask="(99) 9999-9999" disabled="#{estabelecimentoMB.isDisabled}" />
				</h:panelGrid>

				<h:panelGrid columns="8" styleClass="label_10">
					<h:outputLabel  for="contato" value="#{msg.label_contato} " />
					<p:inputText id="contato" value="#{estabelecimentoMB.estabelecimento.contato}" size="40" disabled="#{estabelecimentoMB.isDisabled}" />
				
					<h:outputLabel styleClass="label_50" for="email" value="#{msg.label_email} " />
					<p:inputText id="email" value="#{estabelecimentoMB.estabelecimento.email}" size="25" disabled="#{estabelecimentoMB.isDisabled}" />

					<h:outputLabel styleClass="label_119" for="website" value="#{msg.label_web} " />
					<p:inputText id="website" value="#{estabelecimentoMB.estabelecimento.website}" size="25" disabled="#{estabelecimentoMB.isDisabled}" />
					
					<h:outputLabel styleClass="label_20" for="valores" value="#{msg.label_valor} " />
					<p:inputText id="valores" value="#{estabelecimentoMB.estabelecimento.valor}" disabled="#{estabelecimentoMB.isDisabled}" />
				</h:panelGrid>
				
				<br></br>
				
				<h:panelGrid columns="2" style="margin-bottom:10px">
					<h:outputLabel for="obs" value="#{msg.label_obs} " />
					<p:inputTextarea id="obs" style="margin-left:30px;" value="#{estabelecimentoMB.estabelecimento.obs}" rows="8" cols="80" autoResize="false" disabled="#{estabelecimentoMB.isDisabled}" />
				</h:panelGrid>

				 <p:commandButton ajax="false" action="#{estabelecimentoMB.inserirEstabelecimento}" value="#{msg.btn_cadastrar}"  style="margin-left:1170px; margin-top: 50px;" disabled="#{estabelecimentoMB.isDisabled}" >
				 	<f:actionListener type="casamento.util.ValidaEmpresa"></f:actionListener>
				 </p:commandButton>
				 <p:commandButton oncomplete="imagemAdd.show()" value="#{msg.btn_addImg}"  style="margin-left:1050px; margin-top: -29px;" icon="icone_camera" disabled="#{estabelecimentoMB.isHabilita}"/>
				 <p:commandButton ajax="false" action="#{estabelecimentoMB.novoEstabelecimento}" value="#{msg.btn_novoEst}"  style="margin-left:887px; margin-top: -29px;"/>
				 <p style="margin-top: -10px;"><strong>(*) </strong> Campos Obrigatórios.</p>
			</p:panel>
			
			<ui:include src="../galeria/adicionarImagem.xhtml"></ui:include>
	</h:form>
</ui:define>

</body>
</ui:composition>

